#pragma once

/**
 * 顺序表类型
 */
namespace sl {
    constexpr auto INIT_SIZE = 100;

    using ElemType = int;

    typedef struct {
        ElemType *data;
        int capacity;
        int length;
    } SqList;

    void InitList(SqList &L);

    int Length(SqList &L);

    bool Empty(SqList &L);

    ElemType GetElem(SqList &L, int i);

    void DestroyList(SqList &L);

    void expand(SqList &L);

    bool ListInsert(SqList &L, int i, ElemType e);

    bool ListDelete(SqList &L, int i, ElemType &e);

    int LocateElem(SqList &L, ElemType e);

    void PrintList(SqList const& L);
}